package com.aistar.mapper;


import com.aistar.model.entity.Intern;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface InternMapper {

    //根据resumeId获取实习经历
    @Select("select * from intern where resume_id = #{resumeId}")
    List<Intern> findByResumeId(Integer resumeId);

    //根据id获取实习经历信息
    @Select("select * from intern where id = #{id}")
    Intern findById(Integer id);

    //更新实习经历信息
    @Update("update intern set company_name=#{companyName},company_industry=#{companyIndustry},start_date=#{startDate},end_date=#{endDate},title=#{title},content=#{content} where id = #{id}")
    Integer updateIntern(Intern intern);

    //添加实习经历信息
    @Insert("insert into intern(company_name,company_industry,start_date,end_date,title,content,resume_id) values(#{companyName},#{companyIndustry},#{startDate},#{endDate},#{title},#{content},#{resumeId})")
    Integer insertIntern(Intern intern);

//    //删除教育经历
//    @Delete("delete from intern where id = #{id} and resume_id = #{resumeId}")
//    Integer deleteInternByIdAndResumeId(Integer id,Integer resumeId);

    //删除简历的所有实习经历
    @Delete("delete from intern where resume_id = #{resumeId}")
    Integer deleteInternByResumeId(Integer resumeId);

    @Delete("delete from intern where id = #{id}")
    Integer deleteInternById(Integer id);
}
